![](/file/19402/ADC Tools Sampler CD Disk 3 1999.iso/Documentation/CodeWarrior/HTML/Targeting_Java_VM/images/tbar.gif)
JavaDoc is a batch compiler written in Java by JavaSoft. It processes Java source code files, and uses the comments preceding classes, methods, etc. to generate HTML based documentation for the code. The Java API documentation on your CodeWarrior CD was generated by this compiler.
There is one primary topic discussed in this section:
CodeWarrior implements JavaDoc as a Pre-Linker because of the batch nature of the JavaSoft compiler. The JavaSoft version of JavaDoc must know about all the compiled files simultaneously. In the current CodeWarrior plugin architecture, a compiler works on one file at a time, but a linker knows about all compiled files. So JavaDoc in CodeWarrior is implemented as a pre-linker.
Another added benefit of implementing JavaDoc as a pre-linker is speed. Creating JavaDoc files should be the last thing you do in with your Java project. Assuming this is true, your code will have already been compiled and tested. At this point, when you execute JavaDoc, the process is very fast as everything the pre-linker needs to know was already done at compile time. No need to recompile, just relink.
The JavaDoc plugin uses the Sun JDK or JRE 1.1.6. Therefore, Sun JDK or JRE 1.1.6 must be installed in the system folder in order for JavaDoc to work.
Using JavaDoc is as simple as choosing the JavaDoc pre-linker, and compiling the files.
1. Choose pre-linker for JavaDoc target.
Choose Edit >
Target Settings
, where Target is the name of your current Java target. Choose Target Settings from the list of panels on the left so that the Target Settings panel is displayed. Choose JavaDoc Pre Linker
from the Pre-Linker
pop-up menu in the Target Settings panel (Figure 6.1). Click Save to save changes. Close the Target Settings dialog box. Click OK
for subsequent warning dialogs.
Figure 6.1 Choosing JavaDoc linker
2. Set JavaDoc Project options.
Choose the settings you wish to use for JavaDoc from the
JavaDoc
panel (Figure 6.2). For a full description of each setting in this panel, see "JavaDoc."
Figure 6.2 JavaDoc panel
Compile the project.
Choose Project > Make
. JavaDoc creates a new folder in the same folder as your project called "Docs".
The last step is to open the HTML files in your preferred HTML Browser (Figure 6.3). A separate HTML file is generated for every public Java class included in the target. There are also some default files generated depending on the structure of your Java project.
You may find some links do not work. This is because your project does not include this information. For example, if your project does not include packages, the link to Packages.html fails because the file was not generated by JavaDoc.
The images used in the HTML documents are not automatically generated by JavaDoc, though the HTML source that references these images is generated. You may create your own images to use, use the images from the Java API documentation, or use the images supplied with your CodeWarrior installation. The images provided with the CodeWarrior installation are located in the following places:
Windows
Metrowerks CodeWarrior\Java Support\Metrowerks\JavaDoc\images
Macintosh
Metrowerks CodeWarrior:JavaSupport:Metrowerks:JavaDoc:images
Solaris
Metrowerks CodeWarrior/Java Support/Metrowerks/JavaDoc/images
Figure 6.3 ImageMap Doc Class in Browser
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: support@metrowerks.com
Copyright © 1999, Metrowerks Corp. All rights reserved.
Last updated: May 24, 1999
* Chris Magnuson
* John Roseborough